//CSP2021 Junior Competition2
//Problem 1 candy
//With code as pen, draw beautiful pictures.
//By cyrxdzj
#include<cstdio>
using namespace std;
int n,l,r;
int main()
{
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	scanf("%d%d%d",&n,&l,&r);
	int a=r/n*n;
	if(a>l)
	{
		printf("%d\n",n-1);
	}
	else
	{
		printf("%d\n",r%n);
	}
	return 0;
}

